<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
	<title>txtSQL Documentation</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<link rel="stylesheet" type="text/css" href="./includes/style.css" />
	<script src="./includes/javascript.js"></script>
</head>
<body>

<table width="96%" cellspacing="0" cellpadding="9" border="0" align="center" class="mainTable">
	<tr>
		<td class="header" colspan="2">
			<table cellspacing="0" cellpadding="0" border="0" width="100%">
				<tr>
					<td align="left">
						<a href="index.html">Home</a>
						&nbsp; &nbsp;<a href="javascript:history.back()">Back</a>
						&nbsp; &nbsp;<a href="javascript:history.forward()">Forward</a>
						&nbsp; &nbsp;<a href="javascript:location.reload()">Refresh</a>
						&nbsp; &nbsp;<a href="http://chibiguy.dotgeek.org/index.php">txtSQL Homepage</a>
					</td>
					<td align="right">
						<a href="http://chibiguy.dotgeek.org/index.php" target="_blank"><img src="includes/txtsql_powered_small.gif" /></a>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr valign="top">
		<td class="mainCell">
			<div class="dashedUnderline"><a href="index.html">txtSQL Documentation</a> > <a  href="1.html">'Language Reference'</a> > Functions</div><br />

			<table width="100%">
				<tr valign="bottom">
					<td align="left">
						<div class="h1">Functions </div>
					</td>
					<td align="right">
											</td>
				</tr>
			</table>

			<br />			<div class="content">
				These functions can be used in constructing <a  href="8.html">where clauses</a>. They are only available
where txtSQL >= 2.2.2 RC2. Valid functions are listed below<br><br>

<table width="100%" cellspacing="1" cellpadding="3" border="0" bgcolor="BBBBBB">
    <tr bgcolor="fafafa" align="center">
        <td><b>Function</b></td>
        <td><b>Example</b></td>
        <td><b>Description</b></td>
    </tr>

    <tr bgcolor="fefefe">
        <td>strUpper()</td>
        <td>array('strUpper($a) = $b')</td>
        <td>Converts $a to uppercase</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>strLower()</td>
        <td>array('strLower($a) = $b')</td>
        <td>Converts $a to lowercase</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>chop()</td>
        <td>array('chop($a) = $b')</td>
        <td>Strip whitespace from the end of a string</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>rtrim()</td>
        <td>array('rtrim($a) = $b')</td>
        <td>Strip whitespace from the end of a string</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>ltrim()</td>
        <td>array('ltrim($a) = $b')</td>
        <td>Strip whitespace from the beginning of a string</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>trim()</td>
        <td>array('trim($a) = $b')</td>
        <td>Strip whitespace from the beginning and end of a string</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>md5()</td>
        <td>array('md5($a) = $b')</td>
        <td>Calculates the md5 hash of a string</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>stripSlash()</td>
        <td>array('stripSlash($a) = $b')</td>
        <td>Un-quote string quoted with addslashes </td>
    </tr>

    <tr bgcolor="fefefe">
        <td>strLength()</td>
        <td>array('stripSlash($a) = $b')</td>
        <td>Calculates the length of $a</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>strReverse()</td>
        <td>array('strReverse($a) = $b')</td>
        <td>Reverses $a</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>ucFirst()</td>
        <td>array('ucFirst($a) = $b')</td>
        <td>Makes $a's first character uppercase</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>ucwords()</td>
        <td>array('ucWords($a) = $b')</td>
        <td>Uppercase the first character of each word in a $a</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>bin2hex()</td>
        <td>array('bin2hex($a) = $b')</td>
        <td>Convert binary data into hexadecimal representation</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>entDecode()</td>
        <td>array('entDecode($a) = $b')</td>
        <td>Convert all HTML entities to their applicable characters</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>entEncode()</td>
        <td>array('entEncode($a) = $b')</td>
        <td>Convert all applicable characters to HTML entities</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>soundex()</td>
        <td>array('soundex($a) = $b')</td>
        <td>Calculate the soundex key of a string</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>ceil()</td>
        <td>array('ceil($a) = $b')</td>
        <td>Round fractions up</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>floor()</td>
        <td>array('floor($a) = $b')</td>
        <td>Round fractions down</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>round()</td>
        <td>array('round($a) = $b')</td>
        <td>Rounds a float</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>isNumeric()*</td>
        <td>array('isNumeric($a)')</td>
        <td>Finds whether a variable is a number or a numeric string</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>isString()*</td>
        <td>array('isString($a)')</td>
        <td>Finds whether a variable is a string</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>isFile()*</td>
        <td>array('isFile($a)')</td>
        <td>Tells whether the filename is a regular file</td>
    </tr>

    <tr bgcolor="fefefe">
        <td>isDir()*</td>
        <td>array('isDir($a)')</td>
        <td>Tells whether the filename is a directory</td>
    </tr>
</table>
*- These functions can be negated by placing a '!' in front of the function name.
For example, array('!isdir($a)'). Also these functions can __NOT__ have an operator
in it, they are 'unary functions'.			</div><br /><br />

			
			
			<TEXTAREA ID="holdtext" STYLE="display: none;"></TEXTAREA>			
			<table class="commentTable">
				<tr>
					<td style="border: 0px solid; margin: 0px; padding: 0px;">
						<table width="100%">
							<tr>
								<td style="border:0px solid;">
									<div class="h1">User Comments - Functions</div>
								</td>
								<td align="right" style="border: 0px solid; padding: 0px; margin: 0px;">
									
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td class="row1">
						<div class="commentInfo">
						<b>Faraz Ali</b> &lt;SaiyanM at hotmail dot com&gt;<br />
						<div class="small">July 30, 2004, 11:19 pm</div>
						</div>
						
						<code>You can only use these functions on a column, for example<br />
&lt;?php<br />
$sql-&gt;select(array('where' =&gt; array('strLower(name) = john doe') // correct<br />
                                 // 'name = strLower(john doe) is incorrect,<br />
                                 // will produce unwanted results<br />
...));<br />
?&gt;
</code>
					</td>
				</tr>
			</table>
		</td>

		<td class="sideCell">
		
			<table width="100%" cellspacing="0" cellpadding="0" border="0" class="dashedUnderline">
				<tr>
					<td align="left">
						<a  href="6.html">Last Page</a>					</td>
					<td align="right">
						<a  href="8.html">Next Page</a>					</td>
				</tr>
			</table><br />

			
			<a style="font-weight: bold;"  href="1.html">'Language Reference'</a></b><br />
			<li /> <a  href="2.html">Logical Operators</a><br />
			<li /> <a  href="3.html">Relational Operators</a><br />
			<li /> <a  href="4.html">Data Types</a><br />
			<li /> <a  href="5.html">Column Types</a><br />
			<li /> <a  href="6.html">Primary Keys</a><br />
			<li /> <i>Functions</i><br />
			<li /> <a  href="8.html">Where Clauses</a><br />
			<li /> <a  href="9.html">LIKE Clauses</a><br />
			<li /> <a  href="10.html">Limit Clauses</a><br />
			<li /> <a  href="11.html">OrderBy Clauses</a><br />
			<li /> <a  href="12.html">Notes</a><br />
			<li /> <a  href="75.html">txtSQL 3.0.0 Beta Readme</a><br />
			<br />

			<a style="font-weight: bold;"  href="13.html">User Functions</a></b><br />
			<br />

			<a style="font-weight: bold;"  href="19.html">Database Functions</a></b><br />
			<br />

			<a style="font-weight: bold;"  href="28.html">Data Manipulation Functions</a></b><br />
			<br />

			<a style="font-weight: bold;"  href="34.html">Table Functions</a></b><br />
			<br />

			<a style="font-weight: bold;"  href="42.html">Error Handling Functions</a></b><br />
			<br />

			<a style="font-weight: bold;"  href="52.html">SQL Syntax</a></b><br />
			<br />

		</td>
	</tr>
	<tr>
		<td colspan="2" class="notices" align="center">
			[ txtSQL Documentation powered by <a href="http://chibiguy.dotgeek.org" target="_blank">txtSQL</a> | 6 SQL Queries ]
		</td>
	</tr>
</table>

</body>
</html>